package com.fanrui.code.chess.mahjong;

import java.util.Collection;
import java.util.List;
import java.util.Map;

import com.fanrui.code.chess.mahjong.MahjongStandings.StandingsOperationType;
import com.fanrui.proto.cmd.Operation;
import com.google.gson.annotations.Expose;

public class StandingsRound {
	@Expose
	private StandingsOperationType type;
	@Expose
	private Long targetID;
	@Expose
	private Mahjong[] cards;
	@Expose
	private Map<Long, List<Mahjong>> playerAndCards;
	@Expose
	private Operation operation;
	
	public StandingsRound(StandingsOperationType type, Long targetID, Map<Long, List<Mahjong>> playerAndCards,
			Mahjong... cards) {
		this.type = type;
		this.targetID = targetID;
		this.cards = cards;
		this.playerAndCards = playerAndCards;
	}
	
	public StandingsRound(StandingsOperationType type, Long targetID, Map<Long, List<Mahjong>> playerAndCards,
			Collection<Mahjong> cards) {
		this.type = type;
		this.targetID = targetID;
		if (cards != null) {
			this.cards = new Mahjong[cards.size()];
			cards.toArray(this.cards);
		}
		this.playerAndCards = playerAndCards;
	}

	public void setOperation(Operation operation) {
		this.operation = operation;
	}

}
